import { Types } from 'mongoose';

export * from './auth';

// 基础接口类型
export interface ApiResponse<T = any> {
  success: boolean;
  data?: T;
  error?: string;
  message?: string;
}

// 错误类型
export interface ValidationErrorDetails {
  message: string;
  field?: string;
  [key: string]: any;
}

// 环境变量类型
declare global {
  namespace NodeJS {
    interface ProcessEnv {
      NODE_ENV: 'development' | 'production' | 'test';
      PORT: string;
      MONGODB_URI: string;
      ACCESS_TOKEN_SECRET: string;
      REFRESH_TOKEN_SECRET: string;
      EMAIL_VERIFICATION_SECRET: string;
      RESET_TOKEN_SECRET: string;
      EMAIL_USER: string;
      EMAIL_PASS: string;
      FRONTEND_URL: string;
      REDIS_URL: string;
    }
  }
}

// Re-export mongoose Types
export { Types };

// 辅助类型
export type AsyncFunction<T = any> = (...args: any[]) => Promise<T>;
export type Nullable<T> = T | null;
export type Optional<T> = T | undefined;
